<?php
namespace app\console\controller;

use think\Db;
use think\Request;
use think\Controller;

class MemberRecharge extends Controller
{
    /**
     * 会员 充值
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request)
    {
        // 获取参数
        $inquire = $request->instance()->param();

        // 搜索条件
        $condition['status'] = ['eq', 1];
        $condition['type_id'] = ['eq', 1];

        if (!empty($inquire['title'])) $condition['username'] = ['like', '%' . $inquire['title'] . '%'];

        $data = Db::view('member_withdraw', 'member_id,price,way,status,create_time')
            ->view('member', 'id,username', 'member.id=member_withdraw.member_id')
            ->where($condition)
            ->order(['create_time' => 'desc'])
            ->paginate(10);


        return $this->fetch('', [
            "mate_title" => '会员充值列表',
            'data'       => $data,
        ]);

    }
}
